package com.letoken.platform.pub.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wyl
 * 代币操作-定义枚举
 */
public enum TokenTransactionTypeEnum {

    /**
     * 代币操作-定义枚举
     */
    WHOLE(0, "全部"),
    RECHARGE(1, "收款"),
    WITHDRAW(2, "转账"),
    ISSUE(3, "铸币发行"),
    RELEASE(4, "周期流通"),
    SHARE_REWARD(5, "生态建设加速"),
    ECO_REWARD(6, "生态建设团队加速"),
    USDT_LET(7, "USDT 闪兑 LET"),
    LET_USDT(8, "LET 闪兑 USDT"),
    MALL_LET(9, "商家周期流通"),
    MALL_CONTRIBUTING(10, "让利发行"),
    MALL_WITHDRAWALL_LETOKEN(11, "商家提现"),
    SHOP_LET(12, "商家消费"),
    MALL_INCOME(13, "商家收入"),
    MALL_WITHDRAWALL(14, "商家提现"),

    AMBASSADOR_BONUS_LET(15, "全球推广分红"),
    PEER_LEVEL_REWARD(16, "铸币服务奖"),

    TRANSFER_OUT_BALANCE(17, "余额宝"),
    TRANSFER_IN_BALANCE(18, "余额宝"),
    FUND_ISSUE(19, "基金发行"),

    FUND_REWARD(20, "基金流通"),
    FUND_BONUS(21, "基金团队奖励"),
    FUND_WEIGHTING(22, "基金加权奖励"),
    FUND_SELL(23, "基金赎回"),
    CAP_SUBSCRIPTION(24, "CAP认购"),

    DAY_BOUS(25, "日榜分红"),
    WEEK_BOUS(26, "周榜分红"),
    FUND_LEVEL_REWARD(27, "基金服务奖"),
    EXCHANGE(28, "闪兑"),

    ISSUE_EXCHANGE(29, "铸币发行待流通兑换"),
    MALL_ISSUE_EXCHANGE(30, "商城发行待流通兑换"),
    AMB_ISSUE_EXCHANGE(30, "全球分红待流通兑换"),
    FUND_EXCHANGE(31, "基金发行退回"),
    BALANCE_EXCHANGE(32, "余额宝退回"),
    OHTER_TO_CAPA(33, "资产兑换"),

    NEW_SHOP_PAY(34, "商城消费"),
    NEW_SHOP_REFUND(35, "商城退款"),
    NEW_SHOP_SUCCESS(36, "商城收款"),
    PLEDGE(37, "质押消耗"),
    INCOME(38, "挖矿分红"),
    MALL_BOND(39, "商城缴纳保证金"),
    CAP_GAS(40, "矿工费"),

    MALL_REFUND_BOND(41, "退店保证金"),

    LP_Dividend(42, "LP分红"),

    SHIPPING(43, "退运费"),
    LAMP(44, "灯油奖励"),


    V5(45, "V5平级奖"),
    USDT2LET(46,"资产转换"),
    community(47,"社区服务奖"),
    RED_ENVELOPE_SEND(48,"发红包"),
    RED_ENVELOPE_RECEIVE(49,"领红包"),
    RED_ENVELOPE_RETURN(50,"红包退回"),
    communityV2(51,"社区加速奖"),//v2
    FUND_GIVE(52,"赠送流通"),
    CAP_FUND_Staking(53,"矿机质押"),
    CAP_FUND_Circulation(54,"矿机收益"),
    CAP_FUND_SELL(55,"质押提取"),
    CAP_FUND_Dividends(56,"矿机社区奖励"),
    CAP_airdrop(57,"空投奖励"),
    CAP_airdrop_Community(58,"社区空投奖励"),


    VIDEO_RED_ENVELOPE(59,"视频任务红包"),
    VIDEO_CAP(60,"视频CAP质押红包"),
    ;



    @EnumValue
    private Integer value;
    @JsonValue
    private String text;


    private static Map<String, TokenTransactionTypeEnum> pool = new HashMap<>();


    TokenTransactionTypeEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }

    public final static Map<Integer, String> desc;

    static {
        desc = new HashMap<>();
        for (TokenTransactionTypeEnum value : TokenTransactionTypeEnum.values()) {
            desc.put(value.value, value.text);
        }
    }

    public static TokenTransactionTypeEnum valueOf(int value) {
        return pool.get(String.valueOf(value));
    }

    public Integer getValue() {
        return this.value;
    }

    public String getText() {
        return text;
    }

    public static boolean isSupport(String val) {
        for (TokenTransactionTypeEnum openState : values()) {
            if (openState.getValue().equals(val)) {
                return true;
            }
        }
        return false;
    }

    public static String getText(String val) {
        for (TokenTransactionTypeEnum openState : values()) {
            if (openState.getValue().equals(val)) {
                return openState.getText();
            }
        }
        return "";
    }

}
